import GlobalIniter from './server/inits/global'
import socketStarter from './server/inits/initSocket'

import appIniter from './app'
const Koa = require('koa');
const Router = require('koa-router');
(async () => {
    await GlobalIniter.init();
    let app = await appIniter.init({ logger: LOGGER });
    //初始化全局变量
    const config = APP_CONFIG
    const starter = {
        app,
        server: app,
        port: process.env.PORT || config.port,
        run() {
            this.app.listen(this.port);
            this.app.on('listening', this.onListening)

        },
        onListening() {
            let { port } = this.address    
            console.log(`启动地址：127.0.0.1：${port}`);
        }
 
    }
    starter.run()
})()